import Vue from 'vue';
import App from './App.vue';
import router from './router';
import iView from 'iview';
import cookie from 'js-cookie';
import './assets/font/iconfont.css';
import store from './store';

// import tmpLib from '@td-analytics/schema-inspector';
// Vue.component('schema-inspector', tmpLib.SchemaInspector);
import axios from 'axios';
axios.interceptors.response.use(
  response => {
    return response;
  },
  error => {
    return error.response;
  }
);

// 判断浏览器的语言
const navLang = navigator.language;
const localLang = navLang === 'zh-CN' || navLang === 'en-US' ? navLang : false;

let curLang = null;
const pubStr = localStorage.getItem('_analytics_public');
if (pubStr !== null) {
  const tmpObj = JSON.parse(pubStr) || {};
  curLang = tmpObj.lang;
}

Vue.config.productionTip = false;
Vue.use(iView);

const tmpToken = cookie.get('_app_token_');
Vue.prototype.$demo = (tmpToken || '').indexOf('demo') > -1;

new Vue({
  router,
  store,
  render: h => h(App),
}).$mount('#app');
